package org.mobai.flow.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.HashMap;
import java.util.Map;

/**
 * @author mobai
 */
@Getter
@AllArgsConstructor
public enum BpmnBaseVarEnum {
    NR_OF_INSTANCES("nrOfInstances", "流程实例总数"),
    NR_OF_ACTIVE_INSTANCES("nrOfActiveInstances", "当前活动实例数"),
    NR_OF_COMPLETED_INSTANCES("nrOfCompletedInstances", "已完成实例数"),
    MOBAI_FLOW_STATUS("mobai_flow_status", "流程状态");
    private final String type;
    private final String desc;

    private static final Map<String, BpmnBaseVarEnum> BPMN_BASE_VAR_MAP = new HashMap<>();

    static {
        for (BpmnBaseVarEnum baseVarEnum : BpmnBaseVarEnum.values()) {
            BPMN_BASE_VAR_MAP.put(baseVarEnum.getType(), baseVarEnum);
        }
    }

    public static BpmnBaseVarEnum getByType(String type) {
        return BPMN_BASE_VAR_MAP.get(type);
    }
}
